Page({

  data: {
    repairList: []
  },

  onLoad() {
    this.getRepairList()
  },

  /** 获取报修列表数据 */
  async getRepairList() {
    let res = await wx.http({
      url: '/repair'
    })
    console.log(res);
    let repairList = res.data.rows.map(item => {
      item.houseInfo = item.houseInfo.replace(/(\d)(\d+)/, '$1号楼 $2室')
      item.appointment = item.appointment.replaceAll('-', '/')
      return item
    })
    this.setData({
      repairList
    })
  },

  goDetail(ev) {
    // console.log(ev.mark.id);
    wx.navigateTo({
      url: '/repair_pkg/pages/detail/index?id=' + ev.mark.id,
    })
  },
  addRepair() {
    wx.navigateTo({
      url: '/repair_pkg/pages/form/index',
    })
  },
})


